{% extends "base.html" %}
{% import "_macros.html" as macros %}

{% block title %}个人设置{% endblock %}

{% block head %}
{{ super() }}
  <script src="{{url_for('static', filename='dist/settings.js')}}"></script>
{% endblock %}

{% block content %}
{% set user = request.user  %}
{% if notice %}
  <div id="notice-wrapper" class="container"><div id="notice" class="alert alert-info">保存成功!</div></div>
{% endif %}
<h3 class="text-center">个人设置</h3>
<br>
<form class="form-horizontal" data-toggle="validator" novalidate="novalidate" enctype="multipart/form-data" action="/settings/" accept-charset="UTF-8" method="post">

<div class="form-group">
  <label class="string optional col-sm-2 control-label" for="user_avatar">头像:</label>
  <div class="col-sm-10">
    <img class="user-avatar" src="{{ user.avatar_path }}">
    <input class="avatar-field" type="file" name="user_image" id="user_image">
  </div>
</div>

<div class="form-group string optional user_uname">
  <label class="string optional col-sm-2 control-label" for="nickname">昵称:</label>
  <div class="col-sm-10">
    <input class="string optional form-control" type="text" value="{{ user.nickname }}" name="nickname" id="username">
  </div>
</div>

<div class="form-group">
  <label class="string optional col-sm-2 control-label" for="github_id">GitHub用户名:</label>
  <div class="col-sm-10">
    <div class="input-group">
      <span class="input-group-addon" id="basic-addon1">https://github.com/</span>
      <input class="form-control" placeholder="username" type="text" value="{{ user.github_id }}" name="github_id" id="user_github">
    </div>
  </div>
</div>

<div class="form-group url optional user_blog">
  <label class="url optional col-sm-2 control-label" for="website">个⼈主⻚:</label>
  <div class="col-sm-10">
    <input value="{{ user.website }}" class="string url optional form-control" placeholder="http://" type="url" name="website" id="user_blog">
  </div>
</div>

<div class="form-group string optional user_bio">
  <label class="string optional col-sm-2 control-label" for="intro">一句话介绍:</label>
  <div class="col-sm-10">
    <input class="string optional form-control" placeholder="介绍下自己吧？" type="text" value="{{ user.bio or '' }}" name="bio" id="user_bio">
  </div>
</div>

<div class="form-group">
  <div class="col-sm-offset-2 col-sm-10">
    <input type="submit" name="submit" value="保 存" class="btn btn-default">
  </div>
</div>

</form>
{% endblock %}
